import { createRouter, createWebHistory } from 'vue-router'
import Dashboard from '../views/Dashboard.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/dashboard'
    },
    // 重定向路由，用于刷新页面
    {
      path: '/redirect/:path(.*)*',
      component: () => import('../views/redirect/index.vue')
    },
    {
      path: '/dashboard',
      name: 'dashboard',
      component: Dashboard,
      meta: { title: '仪表盘', category: 'main', categoryLabel: '主导航', icon: 'HomeFilled' }
    },
    {
      path: '/students',
      name: 'students',
      component: () => import('../views/students/StudentList.vue'),
      meta: { title: '学生列表', category: 'education', categoryLabel: '教育管理', icon: 'UsersFilled' }
    },
    {
      path: '/students/performance',
      name: 'student-performance',
      component: () => import('../views/students/StudentPerformance.vue'),
      meta: { title: '成绩管理', category: 'education', categoryLabel: '教育管理', icon: 'UsersFilled' }
    },
    {
      path: '/courses',
      name: 'courses',
      component: () => import('../views/courses/CourseList.vue'),
      meta: { title: '课程列表', category: 'education', categoryLabel: '教育管理', icon: 'BookFilled' }
    },
    {
      path: '/courses/category',
      name: 'course-category',
      component: () => import('../views/courses/CourseCategory.vue'),
      meta: { title: '课程分类', category: 'education', categoryLabel: '教育管理', icon: 'BookFilled' }
    },
    {
      path: '/statistics',
      name: 'statistics',
      component: () => import('../views/statistics/Statistics.vue'),
      meta: { title: '统计分析', category: 'main', categoryLabel: '主导航', icon: 'LineChart' }
    },
    {
      path: '/statistics/student-score',
      name: 'student-score-statistics',
      component: () => import('../views/statistics/StudentScore.vue'),
      meta: { title: '学生成绩分析', category: 'main', categoryLabel: '主导航', icon: 'BarChart3' }
    },
    {
      path: '/statistics/course-trend',
      name: 'course-trend-statistics',
      component: () => import('../views/statistics/CourseTrend.vue'),
      meta: { title: '课程趋势分析', category: 'main', categoryLabel: '主导航', icon: 'LineChart' }
    },
    {
      path: '/statistics/teacher-workload',
      name: 'teacher-workload-statistics',
      component: () => import('../views/statistics/TeacherWorkload.vue'),
      meta: { title: '教师工作量分析', category: 'main', categoryLabel: '主导航', icon: 'PieChart' }
    },
    {
      path: '/statistics/resource-distribution',
      name: 'resource-distribution-statistics',
      component: () => import('../views/statistics/ResourceDistribution.vue'),
      meta: { title: '资源分布分析', category: 'main', categoryLabel: '主导航', icon: 'PieChart' }
    },
    {
      path: '/messages',
      name: 'messages',
      component: () => import('../views/messages/Messages.vue'),
      meta: { title: '消息管理', category: 'communication', categoryLabel: '通讯管理', icon: 'ChatDotSquare' }
    },
    {
      path: '/files',
      name: 'files',
      component: () => import('../views/files/FileManager.vue'),
      meta: { title: '文件管理', category: 'storage', categoryLabel: '存储管理', icon: 'Files' }
    },
    {
      path: '/settings',
      name: 'settings',
      component: () => import('../views/system/SystemConfig.vue'),
      meta: { title: '系统设置', category: 'system', categoryLabel: '系统管理', icon: 'Tools' }
    },
    {
      path: '/users',
      name: 'users',
      component: () => import('../views/user/UserList.vue'),
      meta: { title: '用户管理', category: 'system', categoryLabel: '系统管理', icon: 'UserFilled' }
    },
    {
      path: '/roles',
      name: 'roles',
      component: () => import('../views/system/RoleList.vue'),
      meta: { title: '角色管理', category: 'system', categoryLabel: '系统管理', icon: 'Avatar' }
    },
    {
      path: '/permissions',
      name: 'permissions',
      component: () => import('../views/system/PermissionList.vue'),
      meta: { title: '权限管理', category: 'system', categoryLabel: '系统管理', icon: 'Key' }
    },
    {
      path: '/monitor',
      name: 'monitor',
      component: () => import('../views/system/SystemMonitor.vue'),
      meta: { title: '系统监控', category: 'system', categoryLabel: '系统管理', icon: 'Monitor' }
    },
    {
      path: '/logs',
      name: 'logs',
      component: () => import('../views/system/SystemLogs.vue'),
      meta: { title: '系统日志', category: 'system', categoryLabel: '系统管理', icon: 'Document' }
    },
    {
      path: '/dict',
      name: 'dict',
      component: () => import('../views/system/DataDictionary.vue'),
      meta: { title: '数据字典', category: 'system', categoryLabel: '系统管理', icon: 'Collection' }
    },
    {
      path: '/notice',
      name: 'notice',
      component: () => import('../views/system/NoticeManage.vue'),
      meta: { title: '公告管理', category: 'system', categoryLabel: '系统管理', icon: 'Bell' }
    },
    // 文章管理
    {
      path: '/articles',
      name: 'articles',
      component: () => import('../views/articles/ArticleList.vue'),
      meta: { title: '文章列表', category: 'content', categoryLabel: '内容管理', icon: 'Document' }
    },
    // 添加文章
    {
      path: '/articles/add',
      name: 'article-add',
      component: () => import('../views/articles/ArticleList.vue'),
      meta: { title: '添加文章', category: 'content', categoryLabel: '内容管理', icon: 'Document' }
    },
    // 文章分类管理
    {
      path: '/articles/categories',
      name: 'article-categories',
      component: () => import('../views/articles/CategoryList.vue'),
      meta: { title: '文章分类', category: 'content', categoryLabel: '内容管理', icon: 'Document' }
    },
    // 文章标签管理
    {
      path: '/articles/tags',
      name: 'article-tags',
      component: () => import('../views/articles/TagList.vue'),
      meta: { title: '文章标签', category: 'content', categoryLabel: '内容管理', icon: 'Document' }
    },
    // 文章专题管理
    {
      path: '/articles/topics',
      name: 'article-topics',
      component: () => import('../views/articles/TopicList.vue'),
      meta: { title: '文章专题', category: 'content', categoryLabel: '内容管理', icon: 'Document' }
    },
    // 存储管理
    {
      path: '/storage',
      name: 'storage',
      component: () => import('../views/storage/StorageList.vue'),
      meta: { title: '存储管理', category: 'storage', categoryLabel: '存储管理', icon: 'Files' }
    },
    // 教育管理 - 班级
    {
      path: '/edu/classes',
      name: 'edu-classes',
      component: () => import('../views/edu/ClassList.vue'),
      meta: { title: '班级管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 院系
    {
      path: '/edu/departments',
      name: 'edu-departments',
      component: () => import('../views/edu/DepartmentList.vue'),
      meta: { title: '院系管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 专业
    {
      path: '/edu/majors',
      name: 'edu-majors',
      component: () => import('../views/edu/MajorList.vue'),
      meta: { title: '专业管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 学校
    {
      path: '/edu/schools',
      name: 'edu-schools',
      component: () => import('../views/edu/SchoolList.vue'),
      meta: { title: '学校管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 章节
    {
      path: '/edu/chapters',
      name: 'edu-chapters',
      component: () => import('../views/edu/ChapterList.vue'),
      meta: { title: '章节管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 学生
    {
      path: '/edu/students',
      name: 'edu-students',
      component: () => import('../views/edu/StudentList.vue'),
      meta: { title: '学生管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 教师
    {
      path: '/edu/teachers',
      name: 'edu-teachers',
      component: () => import('../views/edu/TeacherList.vue'),
      meta: { title: '教师管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 教育管理 - 课程
    {
      path: '/edu/courses',
      name: 'edu-courses',
      component: () => import('../views/edu/CourseList.vue'),
      meta: { title: '课程管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 课程管理
    {
      path: '/courses',
      name: 'courses',
      component: () => import('../views/courses/CourseList.vue'),
      meta: { title: '课程列表', category: 'education', categoryLabel: '教育管理', icon: 'BookFilled' }
    },
    // 章节管理
    {
      path: '/chapters',
      name: 'chapters',
      component: () => import('../views/chapters/ChapterList.vue'),
      meta: { title: '章节管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 学生管理
    {
      path: '/students/manage',
      name: 'students-manage',
      component: () => import('../views/students/StudentList.vue'),
      meta: { title: '学生管理', category: 'education', categoryLabel: '教育管理', icon: 'UsersFilled' }
    },
    // 教师管理
    {
      path: '/teachers',
      name: 'teachers',
      component: () => import('../views/teachers/TeacherList.vue'),
      meta: { title: '教师管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 学校管理
    {
      path: '/schools',
      name: 'schools',
      component: () => import('../views/schools/SchoolList.vue'),
      meta: { title: '学校管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    },
    // 考试管理
    {
      path: '/exam',
      name: 'exam',
      component: () => import('../views/exam/ExamList.vue'),
      meta: { title: '考试管理', category: 'education', categoryLabel: '教育管理', icon: 'School' }
    }
  ],
})

export default router